package com.dj.mingkong.portal.biz.core.kaptcha;



import com.google.common.collect.Lists;

import java.awt.*;
import java.security.SecureRandom;
import java.util.List;
import java.util.Random;

/**
 * 验证码颜色
 *
 * @author zenglonghui
 * @date: 2021/12/9 15:05
 */
public class KaptchaColor {
    private KaptchaColor() {}

    public static Color getColor() {
        List<Color> colors = Lists.newArrayList();
        colors.add(new Color(0, 135, 255));
        colors.add(new Color(51, 153, 51));
        colors.add(new Color(255, 102, 102));
        colors.add(new Color(255, 153, 0));
        colors.add(new Color(153, 102, 0));
        colors.add(new Color(153, 102, 153));
        colors.add(new Color(51, 153, 153));
        colors.add(new Color(102, 102, 255));
        colors.add(new Color(0, 102, 204));
        colors.add(new Color(204, 51, 51));
        colors.add(new Color(128, 153, 65));
        Random rand = new SecureRandom();
        int colorIndex = rand.nextInt(10);
        return colors.get(colorIndex);

    }
}
